********** OVERVIEW **********;
*DES 8/7/17;
*reads in shape files, see: cordinate conversion instructions.docx;
/*
Files needed to run: 
1. USroads_lat_coords.dta -- LAC roads shape file with latitude and longitude 
coordinates converted using QGIS/ArcGIS and saved as Stata .dta format, see 
documentation\cordinate conversion instructions.docx

Using the newly created file with latitude and longitude coordinates attached
to the road objects, this file:

1. Merges the coordinate file onto the road file
2. Saves this as a new file
*/

*******************************************************************************/

clear 
set more off
capture log close
#delimit;


global home ;
global rawdata ;
global documentation ;
global output ;


log using "$documentation\make_STROUTEs_allFL.log", text replace;


*Firt setup LAC_raods_Latlong, which is going to be the merged LACroads.dta with LACroads_lat_coords;

import delimited "$rawdata\USroads_lat_coords.csv";


rename _id _ID;

rename x longitude;
rename y latitude; 

sort _ID;

merge m:1 _ID using "$rawdata\USroads.dta";

drop _merge;

save "$rawdata\USroads_analysis.dta", replace;










